package app.auto.runner.activityframe;

import android.app.Activity;
import android.os.Build;

import androidx.annotation.RequiresApi;

import android.view.Gravity;
import android.view.View;
import android.widget.PopupWindow;

import app.auto.AndroidInstance;

public class PopUtil extends AndroidInstance {


    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1)
    public PopupWindow popWindow(Activity acy, View contentview) {
        PopupWindow pop = new PopupWindow(-1, -1);
        pop.setContentView(contentview);
        pop.setFocusable(true);
        pop.setAttachedInDecor(false);
        pop.showAtLocation(acy.getWindow().getDecorView(), Gravity.NO_GRAVITY, 0, 0);
        return pop;
    }

//    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP_MR1)
//    public View pop(Activity acy, View contentview) {
//        View v;
//        ((ViewGroup) acy.findViewById(R.id.frame)).addView(v = contentview, new ViewGroup.MarginLayoutParams(-1, -1));
//        return v;
//    }


    @Override
    public AndroidInstance use(Object mp, Object... p) {
        return null;
    }

}

